<?php

/**
 * Message form.
 *
 * @package    wills
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class MessageForm extends BaseMessageForm
{
  public function configure()
  {
	unset(
	  $this['created_at'],
	  $this['updated_at']
    );
	$this->widgetSchema['content'] = new sfWidgetFormTextArea();

	$this->validatorSchema['author']->setOption('trim', true)
      ->setMessage('required', '姓名不能为空');
	$this->validatorSchema['phone']->setOption('trim', true)
      ->setMessage('required', '电话不能为空');
	$this->validatorSchema['company']->setOption('trim', true)
      ->setMessage('required', '公司不能为空');
	$this->validatorSchema['work']->setOption('trim', true)
      ->setMessage('required', '职位不能为空');
	$this->validatorSchema['email'] = new sfValidatorAnd(array(
		$this->validatorSchema['email'],
		new sfValidatorEmail(),
	   ));
    $this->validatorSchema['email']->setMessages(array(
      'required' => 'Email不能为空',
      'invalid'  => 'Email格式不正确'
    ))->setOption('trim', true);
	$this->validatorSchema['content']->setOption('trim', true)
      ->setMessage('required', '内容不能为空');
  }
}
